﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Net;
using System.Net.Security;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Sec_scan漏洞扫描系统.Sec_New
{
    public partial class LoopScan : Form
    {
        public LoopScan()
        {
            InitializeComponent();
        }
        private void button1_Click(object sender, EventArgs e)
        {
            ServicePointManager.ServerCertificateValidationCallback += Sec_Service.Sec_Ssl_Error.RemoteCertificateValidate;
            string url = textBox1.Text;
            if (string.IsNullOrEmpty(url))
            {
                MessageBox.Show("测试地址不能为空！");
            }
            else
            {
                Sec_Api.Sec_Request_Service_Api.Url = url;
                try
                {
                    Sec_Service.Sec_Request_Service.RequestGet(Sec_Api.Sec_Request_Service_Api.A1);
                    object ok = Sec_Config.Sec_CacheInfo.CacheValue("okinfo");
                    object no = Sec_Config.Sec_CacheInfo.CacheValue("okno");
                    if (ok.ToString().Length > 1)
                    {
                        MessageBox.Show("网站访问成功！");
                    }
                    else
                    {
                        MessageBox.Show("网站访问失败！");
                    }
                    Sec_Config.Sec_CacheInfo.CacheNull("okinfo");
                    Sec_Config.Sec_CacheInfo.CacheNull("okno");
                }
                catch (Exception ex) 
                { 
                    MessageBox.Show("请求错误：" + "\r\n" + ex.Message);
                }
            }
        }
    }
}
